---
import Layout from '@layouts/Layout.astro';
import SectionList from '@components/things/SectionList.astro';
import Main from '@components/scafold/MainCard.astro';
import { fetchData, slugify } from '@utils/fetch-data';
import type { Section } from '../types/Service';
import Button from '@components/form/Button.astro';
interface Props {
title: string;
sections: Section[];
}
const { title, sections } = Astro.props;
const categories = (await fetchData()).categories;
export async function getStaticPaths() {
const pages = await fetchData().then((data) => {
return data.categories.map((category) => {
return {
category: slugify(category.name),
title: category.name,
sections: category.sections,
};
});
});
return pages.map(({ category, title, sections }) => {
return {
params: { category },
props: { title, sections },
};
});
}
const makeCarasolData = () => {
return {
"@context": "https://schema.org",
"@type": "ItemList",
"itemListElement": [
sections.map((section, index) => ({
"@type": "ListItem",
"position": index + 1,
"url": `https://awesomeprivacy.com/${slugify(title)}/${slugify(section.name)}`,
"item": {
"@type": "Service",
"name": section.name,
"url": `https://awesomeprivacy.com/${slugify(title)}/${slugify(section.name)}`,
}
})),
]
}
};
const makeBreadcrumbs = () => {
return [
{ name: 'Home', item: '/' },
{ name: title, item: slugify(title) },
];
};
const makePaginationLinks = () => {
const index = categories.findIndex(category => category.name === title);
const previousCategory = index > 0 ? categories[index - 1].name : null;
const nextCategory = index < categories.length - 1 ? categories[index + 1].name : null;
return { previous: previousCategory, next: nextCategory };
};
const { previous, next } = makePaginationLinks();
---
Or, Browse All {title}